home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 June
/
CHIP Haziran 2001.iso
/
prog
/
share
/
17
/
dings_e.exe
/
Compiler
/
Bin
/
DINGS_MAIN.h
< prev
next >
Wrap
C/C++ Source or Header
|
2001-03-29
|
7KB
|
253 lines
// Function declaration and implementing for DiNGS
#ifndef _DINGS_MAIN_H
#define _DINGS_MAIN_H
#include "Math.h"
#include "stdafx.h"
#include "stdlib.h"
#include "stdio.h"
#include "signal.h"
#include "OpenGLRainbows.h"
#include "OpenGLFont.h"
#include "DirectInput.h"
#include "DXSound.h"
#define CMP_OK 0x00000
#define CMP_FOR_WITHOUT_NEXT 0x00001
#define CMP_SYNTAX_ERROR 0x00002
#define CMP_NO_FILE 0x00003
#define CMP_WRONG_ARGUMENT 0x00004
#define CMP_STRING_TOO_LONG 0x00005
#define CMP_DIVISION_BY_ZERO 0x00006
#define CMP_OUT_OF_MEMORY 0x00007
#define CMP_WRONG_DIMENSION 0x00008
#define CMP_OUT_OF_DIMENSION 0x00009
#define CMP_END_PROGRAM 0x0000A
typedef int DGInt;
// LIMITATIONS
#define MAX_STRLEN 1024
#define MAX_WAV_SAMPLES 0x80
static LPCTSTR lpszAppName = "DiNGS Game Running";
static HINSTANCE hInstance;
// FUNCTIONS
DGInt _Error(DGInt code);
void _EndProgram(void);
void _dLn (DGInt num);
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
// PROTOTYPE FOR MAIN ENTRY
int MainGameSub(void);
int GlobalInit(OpenGLRainbows& rbow, HWND hwnd);
// ------------------------------------------------------------- //
class DGStr
// ------------------------------------------------------------- //
{
public:
DGStr();
DGStr(const char* c);
DGStr(DGInt i);
char GetAt(int i);
int SetAt(int i, char c);
void Left(int i);
DGStr& operator=(const char* s);
DGStr& operator=(const DGInt& i);
DGStr& operator=(const DGStr& s);
DGStr& operator+=(const char* s);
DGStr& operator+=(const DGStr& s);
DGStr& operator+=(const DGInt& i);
operator DGInt() {int i; i=atoi(this->dat); return i;}
operator const char*()const {return this->dat;}
int Compare (const DGStr& s);
int Compare (const DGInt& i);
void TrimRight(void);
private:
char dat[MAX_STRLEN];
};
// ------------------------------------------------------------- //
class DGIntArray
// ------------------------------------------------------------- //
{
public:
DGInt* pData;
DGInt fac2;
DGInt fac3;
DGInt fac4;
DGInt fac5;
DGInt fac6;
DGInt fac7;
DGInt fac8;
DGInt max1;
DGInt max2;
DGInt max3;
DGInt max4;
DGInt max5;
DGInt max6;
DGInt max7;
DGInt max8;
DGInt dim;
DGIntArray() {pData=NULL; dim=-1;}
~DGIntArray() {if (pData) delete[] pData;}
};
// ------------------------------------------------------------- //
class DGStrArray
// ------------------------------------------------------------- //
{
public:
char* pData;
DGInt fac2;
DGInt fac3;
DGInt fac4;
DGInt fac5;
DGInt fac6;
DGInt fac7;
DGInt fac8;
DGInt max1;
DGInt max2;
DGInt max3;
DGInt max4;
DGInt max5;
DGInt max6;
DGInt max7;
DGInt max8;
DGInt dim;
DGStrArray() {pData=NULL; dim=-1;}
~DGStrArray() {if (pData) delete[] pData;}
};
// ------------------------------------------------------------- //
DGInt PutFile(LPCTSTR filename, short line, DGStr& data);
DGInt GetFile(LPCTSTR filename, short line, DGStr& data);
DGInt SIN(DGInt angle);
DGInt COS(DGInt angle);
DGInt TAN(DGInt angle);
DGInt KEY(DGInt key);
DGInt RND(DGInt max);
#define SET(a, b) a =b
#define ADD(a, b) a+=b
DGInt SUB(DGInt& n, DGInt a);
DGInt SUB(DGInt& n, DGStr s);
DGInt SUB(DGStr& s, DGInt n);
DGInt SUB(DGStr& s, DGStr a);
DGInt MUL(DGInt& n, DGInt a);
DGInt MUL(DGInt& n, DGStr s);
DGInt MUL(DGStr& s, DGInt n);
DGInt MUL(DGStr& s, DGStr a);
DGInt DIV(DGInt& n, DGInt a);
DGInt DIV(DGInt& n, DGStr s);
DGInt DIV(DGStr& s, DGInt n);
DGInt DIV(DGStr& s, DGStr a);
DGInt NOT(DGStr& s, DGInt i);
DGInt NOT(DGInt& n, DGInt i);
DGInt OR (DGStr& s, DGInt i);
DGInt OR (DGInt& n, DGInt i);
DGInt AND(DGStr& s, DGInt i);
DGInt AND(DGInt& n, DGInt i);
DGInt ARY(DGIntArray& arr, DGInt dim, DGInt xt1, DGInt xt2=0, DGInt xt3=0, DGInt xt4=0,
DGInt xt5=0, DGInt xt6=0, DGInt xt7=0, DGInt xt8=0);
DGInt ARY(DGStrArray& arr, DGInt dim, DGInt xt1, DGInt xt2=0, DGInt xt3=0, DGInt xt4=0,
DGInt xt5=0, DGInt xt6=0, DGInt xt7=0, DGInt xt8=0);
DGInt GETARR(DGInt& rv, DGInt dim, DGIntArray& arr, DGInt xt1, DGInt xt2=0, DGInt xt3=0,
DGInt xt4=0, DGInt xt5=0, DGInt xt6=0,
DGInt xt7=0, DGInt xt8=0);
DGInt GETARR(DGStr& rv, DGInt dim, DGStrArray& arr, DGInt xt1, DGInt xt2=0, DGInt xt3=0,
DGInt xt4=0, DGInt xt5=0, DGInt xt6=0,
DGInt xt7=0, DGInt xt8=0);
DGInt PUTARR(DGInt rv, DGInt dim, DGIntArray& arr, DGInt xt1, DGInt xt2=0, DGInt xt3=0,
DGInt xt4=0, DGInt xt5=0, DGInt xt6=0,
DGInt xt7=0, DGInt xt8=0);
DGInt PUTARR(DGStr& rv, DGInt dim, DGStrArray& arr, DGInt xt1, DGInt xt2=0, DGInt xt3=0,
DGInt xt4=0, DGInt xt5=0, DGInt xt6=0,
DGInt xt7=0, DGInt xt8=0);
void NSAME(DGInt& i, DGInt j);
void NSAME(DGInt& i, DGStr s);
void NSAME(DGStr& s, DGInt i);
void NSAME(DGStr& s, DGStr t);
void SAME(DGInt& i, DGInt j);
void SAME(DGInt& i, DGStr s);
void SAME(DGStr& s, DGInt i);
void SAME(DGStr& s, DGStr t);
void BIGGER(DGInt& i, DGInt j);
void BIGGER(DGInt& i, DGStr s);
void BIGGER(DGStr& s, DGInt i);
void BIGGER(DGStr& s, DGStr t);
void BIG_EQ(DGInt& i, DGInt j);
void BIG_EQ(DGInt& i, DGStr s);
void BIG_EQ(DGStr& s, DGInt i);
void BIG_EQ(DGStr& s, DGStr t);
void SMAL_EQ(DGInt& i, DGInt j);
void SMAL_EQ(DGInt& i, DGStr s);
void SMAL_EQ(DGStr& s, DGInt i);
void SMAL_EQ(DGStr& s, DGStr t);
void SMALER(DGInt& i, DGInt j);
void SMALER(DGInt& i, DGStr s);
void SMALER(DGStr& s, DGInt i);
void SMALER(DGStr& s, DGStr t);
DGInt END();
DGInt MIDSTR(DGStr s, DGStr& mid, DGInt start, DGInt len);
DGInt BLACKSCREEN(void);
DGInt BLENDSCREEN(DGStr s);
DGInt PLAYMOVIE(DGStr s);
DGInt PRINT(DGStr s, DGInt x, DGInt y);
DGInt PRINT(DGInt i, DGInt x, DGInt y);
DGInt ROTOSPRITE(DGInt num, DGInt x, DGInt y, DGInt angle, DGInt alpha);
DGInt ROTOZOOMSPRITE(DGInt num, DGInt x, DGInt y, DGInt angle, DGInt size, DGInt alpha);
DGInt SHOWSCREEN(void);
DGInt SPRITE(DGInt num, DGInt x, DGInt y, DGInt alpha);
DGInt USEASBMP();
DGInt ZOOMSPRITE(DGInt num, DGInt x, DGInt y, DGInt xsize, DGInt ysize, DGInt alpha);
DGInt INPUT(DGStr& s, DGInt x, DGInt y);
DGInt INPUT(DGInt& s, DGInt x, DGInt y);
DGInt JOYSTATE(DGInt& jx, DGInt& jy, DGInt& b1, DGInt& b2);
DGInt KEYWAIT(void);
DGInt MOUSESTATE(DGInt& jx, DGInt& jy, DGInt& b1, DGInt& b2);
DGInt MOUSEWAIT(void);
DGInt GETFILE(DGStr file, DGInt line, DGInt& num);
DGInt GETFILE(DGStr file, DGInt line, DGStr& str);
DGInt PUTFILE(DGStr file, DGInt line, DGInt num);
DGInt PUTFILE(DGStr file, DGInt line, DGStr str);
DGInt LOADBMP(DGStr s);
DGInt LOADFONT(DGStr s);
DGInt LOADSPRITE(DGStr s, DGInt n);
DGInt LOADSOUND(DGStr s, DGInt num, DGInt buffers);
DGInt PLAYSOUND(DGInt num, DGInt fade);
DGInt HUSH(void);
DGInt SAVEBMP(DGStr s);
DGInt BOXCOLL(DGInt& check, DGInt x1, DGInt y1, DGInt w1, DGInt h1, DGInt x2, DGInt y2, DGInt w2, DGInt h2);
#endif // DEFINE
// Extern Symbols
extern OpenGLRainbows rbow;
extern OpenGLFont fnt;
extern DirectInput DXin;
extern int _DG_RESX;
extern int _DG_RESY;
extern int _DG_DEBUG;
extern int _DG_FULLSCREEN;
extern int _DG_FRAMERATE;
extern int __HR;
extern DGInt _g_mx, _g_my;
extern DGInt _g_debugline;
extern DGInt _g_error;
extern DGInt _g_errorline;